package org.karelun.gef.editors;

import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IPersistableElement;

public class DiagramEditorInput implements IPathEditorInput {

	private IPath path;

	public DiagramEditorInput(IPath path) {
		this.path = path;
	}

	public IPath getPath() {
		return path;
	}

	@Override
	public boolean exists() {
		if (path != null)
			return path.toFile().exists();
		return false;
	}

	@Override
	public ImageDescriptor getImageDescriptor() {
		return null;
	}

	@Override
	public String getName() {
		if (path != null)
			return path.toString();
		return null;
	}

	@Override
	public IPersistableElement getPersistable() {
		return null;
	}

	@Override
	public String getToolTipText() {
		if (path != null)
			return path.toString();
		return null;
	}

	@SuppressWarnings("unchecked")
	public Object getAdapter(Class adapter) {
		return null;
	}

	public int hashCode() {
		if (path != null)
			return path.hashCode();
		return super.hashCode();
	}
}
